<html>
<head>
	<link rel="icon" href="data:;base64,=" />
	<title>Simple lzma.js demo</title>
	<script src="../src/lzma.js"></script>
	<script src="../src/lzma.shim.js"></script>
	<script src="libs/digest.md5.js"></script>
	<script>var tsturl = '../data/stars.pos.db.lzma';</script>
</head>
<body>
	<script>

		var oReq = new XMLHttpRequest();
		oReq.open("GET", tsturl, true);
		oReq.responseType = "arraybuffer";
		oReq.onload = function(oEvent)
		{
			var t0 = performance.now();
			// invoke synchronous decoding
			var outStream = new LZMA.oStream();
			LZMA.decode(oReq.response, outStream)
			// report the decoding time
			var t9 = performance.now();
			var delta = (t9 - t0).toFixed(2);
			console.info("in " + delta + " ms.")
			var md5 = new MD5();
			function digest(bytes) {
				for (var i = 0; i < bytes.length; i++) {
					md5.addByte(bytes[i]);
				}
			}
			outStream.forEach(digest);
			console.log("MD5", md5.getHex());
		};
		oReq.send();

	</script>
</body>
</html>
